package com.itlong.cloud.app.resource;

import com.itlong.cloud.app.service.IAppOldServeService;
import com.itlong.cloud.enumerate.oldapp.Message;
import com.itlong.cloud.user.app.IAppOldServeServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *     旧版APP的服务版块接口代理实现
 * </desc>
 * Created 2017/11/13.
 */
@RestController
public class AppOldServeServiceResource implements IAppOldServeServiceClient {

    @Autowired
    IAppOldServeService iAppOldServeService;

    /**
     * <desc>
     *     旧版APP_获取服务版块的广告
     * </desc>
     * @param type
     * @param phoneNo
     * @param projectId
     * @return
     * @throws Exception
     * @author cuiduanwu
     * @createDate 2017/11/13
     */
    @Override
    @RequestMapping(path = "/lifeservice/ads",method = RequestMethod.POST)
    public Message getAd(@RequestParam("phoneNo") String phoneNo,@RequestParam("projectId") String projectId,@RequestParam("type") String type) throws Exception{
        return  iAppOldServeService.getAd(phoneNo,projectId,type);
    }

    /**
     * <desc>
     *     旧版APP_用户报修或投诉
     * </desc>
     * @param phoneNo
     * @param imageStr
     * @param imageType
     * @param propertyInfo
     * @param projectId
     * @param type 3-报修，4-投诉
     * @return
     * @throws Exception
     * @author cuiduanwu
     * @createDate 2017/11/13
     */
    @Override
    @RequestMapping(path = "/app/property/reportRepair",method = RequestMethod.POST)
    public Message addReportRepairOrComplaint(@RequestParam("phoneNo") String phoneNo,@RequestParam("imageStr") String imageStr,
        @RequestParam("imageType") String imageType,@RequestParam("propertyInfo") String propertyInfo,
        @RequestParam("projectId") String projectId,@RequestParam("type") String type) throws Exception{
        return  iAppOldServeService.addReportRepairOrComplaint(phoneNo, imageStr, imageType, propertyInfo, projectId, type);
    }

    /**
     * <desc>
     *     旧版APP_检测APP版本
     * </desc>
     * @param type android/ios/iossdk/androidsdk
     * @param sort test/official
     * @return
     * @author cuiduanwu
     * @createDate 2017/11/14
     */
    @Override
    @RequestMapping(path = "/app/version/latest",method = RequestMethod.POST)
    public Message getLatestApp(@RequestParam("type") String type,@RequestParam("sort") String sort){
        return  iAppOldServeService.getLatestApp(type,sort);
    }










}
